class NotificationManager {
    static container = null;

    static init() {
        // 创建通知容器
        if (!this.container) {
            this.container = document.createElement('div');
            this.container.className = 'notification-container';
            document.body.appendChild(this.container);
        }
    }

    static show(message, type = 'info') {
        this.init();
        
        const notification = document.createElement('div');
        notification.className = `notification ${type}`;
        notification.textContent = message;
        
        // 添加到容器
        this.container.appendChild(notification);
        
        // 淡入效果
        setTimeout(() => notification.style.opacity = '1', 10);
        
        // 自动消失
        setTimeout(() => {
            notification.style.opacity = '0';
            setTimeout(() => notification.remove(), 300);
        }, 3000);
    }

    static success(message) {
        this.show(message, 'success');
    }

    static error(message) {
        this.show(message, 'error');
    }

    static info(message) {
        this.show(message, 'info');
    }

    static warning(message) {
        this.show(message, 'warning');
    }
}

// 创建全局快捷方法
window.showNotification = (message, type) => NotificationManager.show(message, type); 